import axios from 'axios';

const request = axios.create({
  // 配置通用header
  baseURL: 'https://evp.51job.com/51job/api/1.0/index.php/msd/admin'
});

// 配置拦截器  1001 跳转登录
request.interceptors.response.use(
  response => {
    if (response.data.code) {
      if (response.data.code === 1001) {
        // 跳转登录页
        window.localStorage.removeItem('msd_token');
        window.location.reload();
      }
    }
    return response
  }
);

export default request;